﻿
using AutoMapper;
using MediatR;
using S_Gridding.Api.Application.Commands.MeshType;
using S_Gridding.Api.Application.Commands.Respon;
using S_Gridding.Domains.FoundGridding;
using S_Gridding.Infrastructure.Imp.Write;
using S_Gridding.Infrastructure.Interface.IWrite;

namespace S_Gridding.Api.Application.CommandsHanders.ResponHanders
{
    public class ResponDelCommandsHanders : IRequestHandler<ResponDelCommands, int>
    {
        private readonly IResponRepository _respon;

        public ResponDelCommandsHanders(IResponRepository respon)
        {
            _respon = respon;
        }

        public async Task<int> Handle(ResponDelCommands request, CancellationToken cancellationToken)
        {
            var list = await _respon.GetFindAsync(request.Id);
            list.IsDel = true;
            return await _respon.UpdateAsync(list);
        }
    }
}
